// Copyright (c) Microsoft Corporation.  All rights reserved.

#include "stdafx.h"
#include "D3D10Texture2D.h"

using namespace Microsoft::WindowsAPICodePack::DirectX::Direct3D10;

Texture2dDescription^ Texture2D::GetDescription()
{
    Texture2dDescription^ desc = gcnew Texture2dDescription();
    GetInterface<ID3D10Texture2D>()->GetDesc(desc->nativeObject.Get());
    return desc;
}

MappedTexture2d^ Texture2D::Map(UInt32 subresourceIndex, D3D10::Map type, MapFlag flags)
{
    MappedTexture2d^ texture = gcnew MappedTexture2d();
    CommonUtils::VerifyResult(GetInterface<ID3D10Texture2D>()->Map(static_cast<UINT>(subresourceIndex), static_cast<D3D10_MAP>(type), static_cast<UINT>(flags), texture->nativeObject.Get()));
    return texture;
}

void Texture2D::Unmap(UInt32 subresourceIndex)
{
    GetInterface<ID3D10Texture2D>()->Unmap(static_cast<UINT>(subresourceIndex));
}
